<?xml version="1.0" encoding="utf-8"?>
<openerp>
	<data>
		<record id="journal_voucher_new_tree" model="ir.ui.view">
			<field name="name">journal.voucher.new.tree</field>
			<field name="model">journal.voucher.new</field>
			<field name="type">tree</field>
			<field name="arch" type="xml">
				<tree string="Journal Vouchers">
					<field name="name"/>
					<field name="journal_id"/>
					<field name="period_id"/>
					<field name="date"/>
					<field name="state"/>
				</tree>
			</field>
		</record>

		<record id="journal_voucher_new_form" model="ir.ui.view">
			<field name="name">journal.voucher.new.form</field>
			<field name="model">journal.voucher.new</field>
			<field name="arch" type="xml">
				<form string = "Journal Vouchers">
					<header>
						<button name="button_validate" states="draft" string="Post" type="object" icon="terp-camera_test"/>
						<button name="button_cancel" states="posted" string="Cancel" type="object" icon="gtk-cancel"/>
						<button name="set_to_draft" states="cancel" string="Set To Draft" type="object"/>
						<button name="print_out" string="Print" type="object" states="draft,posted" groups="base.group_user"/>
						<field name="state" widget="statusbar" statusbar_visible="draft,posted" statusbar_colors='{"draft":"blue"}'/>
					</header>
					<sheet string="Journal Vouchers">
						<group>
							<group>
								<field name="name"/>
								<field name="journal_id" domain="[('type','=','general')]"/>
								<field name="date"/>
							</group>
							<group>
								<field name="ref"/>
								<field name="memo"/>
								<field name="period_id"/>
							</group>
						</group>
						<notebook>
							<page string="Journal Items" attrs="{'readonly': [('state','!=','draft')]}">
								<field name="line_id" nolabel="1">
									<tree string="Lines" editable="bottom">
										<field name="account_id" colspan="2"/>
										<field name="debit" on_change="onchange_amount_debit(parent.date,currency_id,debit,credit,ex_rate_other)" sum="Total Debit"/>
										<field name="credit" on_change="onchange_amount_credit(parent.date,currency_id,debit,credit,ex_rate_other)"  sum="Total Credit"/>
										<field name="debit_home" sum="Total Debit Home" on_change="onchange_amount_debit(parent.date,currency_id,debit,credit,ex_rate_other)"/>
										<field name="credit_home" sum="Total Credit Home" on_change="onchange_amount_credit(parent.date,currency_id,debit,credit,ex_rate_other)"/>
										<field name="name"/>
										<field name="currency_id" on_change="onchange_currency(parent.date,currency_id,debit,credit,ex_rate_other)"/>
										<field name="ex_rate_other"  on_change="onchange_currency(parent.date,currency_id,debit,credit,ex_rate_other)"/>
										<field name="ex_rate"/>
									</tree>
								</field>
							</page>
							<page string="Journal Posted" attrs="{'invisible': [('state','!=','posted')]}">
								<field name="move_ids" readonly="1" nolabel="1">
									<tree string="Journal Items">
										<field name="move_id"/>
										<field name="ref"/>
										<field name="date"/>
										<field name="statement_id"/>
										<field name="partner_id"/>
										<field name="account_id"/>
										<field name="name"/>
										<field name="debit"/>
										<field name="credit"/>
										<field name="state"/>
										<field name="reconcile_id"/>
									</tree>
								</field>
							</page>
						</notebook>
					</sheet>

				</form>
			</field>
		</record>

		<record id="journal_voucher_new_select" model="ir.ui.view">
			<field name="name">journal.voucher.new.select</field>
			<field name="model">journal.voucher.new</field>
			<field name="type">search</field>
			<field name="arch" type="xml">
				<search string="Search Move">
					<group>
						<filter icon="terp-document-new" string="Unposted" domain="[('state','=','draft')]" help="Unposted Journal Entries"/>
						<filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Journal Entries"/>
						<separator orientation="vertical"/>
						<field name="name"/>
						<field name="ref"/>
						<field name="date"/>
					</group>
					<newline/>
					<group>
						<field name="journal_id" widget="selection"/>
						<field name="period_id"/>
					</group>
				</search>
			</field>
		</record>

		<record id="action_journal_voucher_new" model="ir.actions.act_window">
			<field name="name">Journal Vouchers</field>
			<field name="res_model">journal.voucher.new</field>
			<field name="view_type">form</field>
			<field name="view_mode">tree,form</field>
			<field name="view_id" ref="journal_voucher_new_tree"/>
			<field name="search_view_id" ref="journal_voucher_new_select"/>
		</record>

		<menuitem action="action_journal_voucher_new" id="menu_journal_voucher_new" parent="account.menu_finance_entries" sequence="7"/>


		<record id="journal_voucher_lines_new_tree" model="ir.ui.view">
			<field name="name">journal.voucher.lines.new.tree</field>
			<field name="model">journal.voucher.lines.new</field>
			<field name="type">tree</field>
			<field name="arch" type="xml">
				<tree string="Journal Items">
					<field name="account_id"/>
					<field name="currency_id"/>
					<field name="debit" sum="Total Debit"/>
					<field name="credit" sum="Total Credit"/>
					<field name="debit_home" sum="Total Debit Home"/>
					<field name="credit_home" sum="Total Credit Home"/>
					<field name="ex_rate_other"/>
					<field name="ex_rate"/>
				</tree>
			</field>
		</record>

		<record id="journal_voucher_lines_new_form" model="ir.ui.view">
			<field name="name">journal.voucher.lines.new.form</field>
			<field name="model">journal.voucher.lines.new</field>
			<field name="type">form</field>
			<field name="arch" type="xml">
				<form string = "Lines">
					<field name="account_id"/>
					<field name="currency_id" on_change="onchange_currency(parent.date,currency_id,debit,credit,ex_rate_other)"/>
					<field name="debit" on_change="onchange_amount_debit(parent.date,currency_id,debit,credit,ex_rate_other)"/>
					<field name="credit" on_change="onchange_amount_credit(parent.date,currency_id,debit,credit,ex_rate_other)"/>
					<field name="debit_home" on_change="onchange_amount_debit(parent.date,currency_id,debit,credit,ex_rate_other)"/>
					<field name="credit_home" on_change="onchange_amount_credit(parent.date,currency_id,debit,credit,ex_rate_other)"/>
					<field name="ex_rate_other" on_change="onchange_currency(parent.date,currency_id,debit,credit,ex_rate_other)"/>
					<field name="ex_rate"/>
					<field name="name" colspan="4"/>
				</form>
			</field>
		</record>
	</data>
</openerp>
